import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;
import java.net.*;

public class Signal implements MouseListener
{

    public Image l;
    public Image bl;
    public Image select;
    public boolean dbl;
    public boolean outline;
    public AudioClip batclip;

    public Signal ()
    {
        dbl = false;
        outline = false;
        ImageIcon pic = new ImageIcon(getClass().getResource("./light.png"));
        ImageIcon batlight = new ImageIcon(getClass().getResource("./batlight.png"));
        ImageIcon selectlight = new ImageIcon(getClass().getResource("./selectlight.png"));
        
        Class metaObject = this.getClass();
        URL url = metaObject.getResource("theme.au");
        
        batclip = Applet.newAudioClip(url);
        
        l = pic.getImage();
        bl = batlight.getImage();
        select = selectlight.getImage();
    }
    
    public void paint(Graphics g)
    {
        g.drawImage(l, 50, 400, null);
        if (dbl)
            g.drawImage(bl, 0, 0, null);
        if (outline)
            g.drawImage(select, 50, 400, null);
    }
    
    public void mousePressed(MouseEvent e)
    {
        if (e.getX() >= 50 && e.getX() <= 120 && e.getY() >= 400 && e.getY() <= 490)
        {
            dbl = true;
            batclip.play();    
        }
        else
        {
            outline = true;
        }
        
    }
    public void mouseReleased(MouseEvent e){
        dbl = false;
        outline = false; 
    }
    public void mouseClicked(MouseEvent e){}
    public void mouseEntered(MouseEvent e){
            
    }
    public void mouseExited(MouseEvent e){
                
    }

}
